#include "DebugTools.h"



void printInputAndOutputsInfo(const ov::Model& network){
    qDebug() << "Network inputs:" ;
    for (auto&& input : network.inputs()) {
        std::string in_name;
        std::string node_name;

        // Workaround for "tensor has no name" issue
        try {
            for (const auto& name : input.get_names()) {
                in_name += name + " , ";
            }
            in_name = in_name.substr(0, in_name.size() - 3);
        } catch (const ov::Exception&) {
        }

        try {
            node_name = input.get_node()->get_friendly_name();
        } catch (const ov::Exception&) {
        }

        if (in_name == "") {
            in_name = "***NO_NAME***";
        }
        if (node_name == "") {
            node_name = "***NO_NAME***";
        }

        qDebug() << "    " << in_name << " (node: " << node_name << ") : " << input.get_element_type().get_type_name() << " / "
                   << ov::layout::get_layout(input).to_string() << " / " << input.get_partial_shape().to_string() ;
    }

    qDebug() << "Network outputs:" ;
    for (auto&& output : network.outputs()) {
        std::string out_name;
        std::string node_name;

        // Workaround for "tensor has no name" issue
        try {
            for (const auto& name : output.get_names()) {
                out_name += name + " , ";
            }
            out_name = out_name.substr(0, out_name.size() - 3);
        } catch (const ov::Exception&) {
        }
        try {
            node_name = output.get_node()->get_input_node_ptr(0)->get_friendly_name();
        } catch (const ov::Exception&) {
        }

        if (out_name == "") {
            out_name = "***NO_NAME***";
        }
        if (node_name == "") {
            node_name = "***NO_NAME***";
        }

        qDebug() << "    " << out_name << " (node: " << node_name << ") : " << output.get_element_type().get_type_name() << " / "
                   << ov::layout::get_layout(output).to_string() << " / " << output.get_partial_shape().to_string() ;
    }
}
